package com.wl.shop.dao;

import com.wl.shop.annotation.MyBatisDao;
import com.wl.shop.entity.Category;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;

/**
 * <p>
  *  Mapper 接口
 * </p>
 *
 * @author wangl
 * @since 2017-05-24
 */
@MyBatisDao
public interface CategoryDao extends BaseMapper<Category> {

	Integer selectMaxSort(String parentId);
	
	Category selectCategoryByParam(Map<String,Object> map);
	
	/**
	 * 测试用例
	 * @param parentId
	 * @param page
	 * @return
	 */
	@Select("select c.name,p.name as parentName from cms_category c "
			+ " left join cms_category p on p.id = c.parent_id"
			+ " and c.parent_id = #{parentId}")
	List<Category>  listByParentId(@Param("parentId") String parentId,Page<Category> page );

}